package com.formation.jaxb.marshalling;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
 
@XmlRootElement(name = "personne")
@XmlType(propOrder={"id", "nom", "prenom", "adresses"})
public class Personne {
	
	private int id;
	private String nom;
	private String prenom;
	
	//liste des adresses
	
	private List<Adresse> adresses =new ArrayList<>();
	
	//transforme id en attribut xml
	@XmlAttribute(name="ref-client")
	public int getId() {
		return id;
	}
	
	@XmlElementWrapper(name="carnet") 
    @XmlElement(name="adresse") 
	public List<Adresse> getAdresses() {
		return adresses;
	}

	public String getNom() {
		return nom;
	}

	public String getPrenom() {
		return prenom;
	}

	public void setId(int id) {
		this.id = id;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}

	public void setAdresses(List<Adresse> adresses) {
		this.adresses = adresses;
	}
	
}
